Write a rule that uses a custom function

Write a rule that uses a custom function

What is a Custom Function?

A function written in Java or .NET, conforming to a particular interface that makes it accessible from within a rulebase. Inputs are defined by the custom function, and are most often attributes whose values are used by the custom function.

What can a Custom Function do?

Possible uses of custom functions are:

Call a Custom Function

To call a custom function, use the following syntax:

The custom function inputs in brackets are defined by the custom function.

For example, a custom function "AccidentDamage" to calculate the total accident damage, where "the total accident damage", "the damage to car 1", and "the damage to car 2" are all number attributes (percentages), would be called in a rule as follows:

the total accident damage = AccidentDamage(the damage to car 1, the damage to car 2)

 

Note that a custom function is called in the same way as any of the other built-in functions in Oracle Policy Modeling, and similarly the custom function rule will take part in the question search and be included in decision reports in the same way as any other built-in function. Any of the input attribute values can be temporal, as can the custom function return value.

The custom function must be defined in the \Extensions\<extension name> project folder before any rules using it can be compiled. See Install a custom function for details. TIP: Create and debug your custom function in a small test project , and then copy it into your actual project.

 

For more information, refer to the Write a Custom Function Extension topic in the Oracle Policy Automation Developer's Guide.